package com.cskaoyan.controller.wx.comment;

import com.cskaoyan.bean.bo.wxcommitbo.WxCommentBo;
import com.cskaoyan.bean.bo.wxcommitbo.WxPostCommentBo;
import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.po.MarketComment;
import com.cskaoyan.bean.vo.wxcommentvo.WxCommentCount;
import com.cskaoyan.bean.vo.wxcommentvo.WxCommentVo;
import com.cskaoyan.service.wx.wxcommentservice.WxCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description:todo 评论相关
* @Author:todo wang xv
* @Date:todo 2022/11/23
*/
@RestController
@RequestMapping("wx/comment")
public class WxCommentController {

    @Autowired
    WxCommentService commentService;

    /**
    * @Description:todo
    * @Author:todo wang xv
    * @Date:todo 2022/11/23
    */
    @RequestMapping("list")
    public BaseRespVo queryCommentList(WxCommentBo commitBo){
        WxCommentVo wxCommentVo =commentService.queryCommentList(commitBo);
        return BaseRespVo.succeed(wxCommentVo);
    }

    /**
    * @Description:todo 显示评论数量
    * @Author:todo wang xv
    * @Date:todo 2022/11/23
    */
    @RequestMapping("count")
    public BaseRespVo queryCommentCount(Integer valueId,byte type){
        WxCommentCount commentCount =commentService.queryCommentCount(valueId,type);
        return BaseRespVo.succeed(commentCount);
    }

    /**
    * @Description:todo 发出评论
    * @Author:todo wang xv
    * @Date:todo 2022/11/23
    */
    @PostMapping("post")
    public BaseRespVo postComments(@RequestBody WxPostCommentBo postCommentBo){
       MarketComment comment = commentService.postComment(postCommentBo);
       return BaseRespVo.succeed(comment);
    }
}
